#!/bin/bash
set -e

function info() {
echo Usage: `basename $0` [-l in.bed] in.bam [in2.bam ...]
exit 65
}

while getopts  ":l:p:" opts
do
        case  $opts  in
        l) bed=$OPTARG;;
		p) out_prefix=$OPTARG;;
		*) info;;
        esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi


. /mnt/ilustre/app/medical/tools/.var



for item; do
input="$input -I $item"
done
echo $input

if test -n "$bed"; then

echo $bed;
echo;echo;echo gatk UG
java -Djava.awt.headless=true $tmp -Xmx$java_memory -jar $gatk \
-T UnifiedGenotyper \
-R $ref_genome \
$input \
-o $out_prefix.vcf \
-glm BOTH \
--dbsnp $data_path/ncbi/dbsnp/All_20150605.vcf.gz \
-S SILENT \
-nt 10 \
-dt BY_SAMPLE \
-dcov 2500 \
-l INFO \
-mbq 20 \
-rf BadCigar \
-log .ug.log \
-L $bed

else

echo no bed
echo;echo;echo gatk UG
java -Djava.awt.headless=true $tmp -Xmx$java_memory -jar $gatk \
-T UnifiedGenotyper \
-R $ref_genome \
$input \
-o $out_prefix.vcf \
-glm BOTH \
--dbsnp $data_path/ncbi/dbsnp/All_20150605.vcf.gz \
-S SILENT \
-nt 10 \
-dt BY_SAMPLE \
-dcov 2500 \
-l INFO \
-mbq 20 \
-rf BadCigar \
-log .ug.log

fi

:<<!
java -Djava.awt.headless=true $tmp $java_memory -jar $gatk \
-T CombineVariants 
-R file_path/hg19_all.fa
-o /file_path/SN.vcf
–V /file_path/SN_0.vcf 
–V /file_path/SN_1.vcf … -V 
/file_path/SN_204.vcf






!